package com.jumi.microservice.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.scripting.support.ResourceScriptSource;

import java.util.List;

/**
 * @author Administrator
 */
@Configuration(proxyBeanMethods = false)
public class StockRedisAutoConfiguration {

    @Bean
    public DefaultRedisScript<List> redisScript() {
        DefaultRedisScript<List> redisScript = new DefaultRedisScript<>();
        redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("scripts/stock.lua")));
        redisScript.setResultType(List.class);
        return redisScript;
    }
}
